package com.godpaper.as9.commands
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.godpaper.as9.bussiness.delegates.ClassDelegate;
	import com.godpaper.as9.constants.ServiceInfoList;
	import com.godpaper.as9.events.GetClassInfoEvent;
	import com.godpaper.as9.model.ClassModelLocator;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;

	public class GetClassInfoCommand extends CommandBase implements ICommand, IResponder
	{
		private var delegate:ClassDelegate;
		private var classModel:ClassModelLocator = ClassModelLocator.getInstance();
		private var getClassInfoEvent:GetClassInfoEvent;
		
		public function GetClassInfoCommand()
		{
			super();
			delegate = new ClassDelegate(this);
		}

		override public function execute(event:CairngormEvent):void
		{
			getClassInfoEvent = GetClassInfoEvent(event);
			
			delegate.read(ServiceInfoList.OPERATION_READ,null);
//			delegate.read(ServiceList.OPERATION_READ,3);
		}
		
		override public function result(data:Object):void
		{
			classModel.classInfo.source = data.result;
		} 
		
	}
}